package com.netcracker.lab1.controller;

import com.netcracker.lab1.model.*;

import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * User: nocturne
 * Date: 11.01.13
 * Time: 14:18
 * To change this template use File | Settings | File Templates.
 */
public class MusicTrackController {

    private AbstractMusicTrackManager mtm = null;

    public MusicTrackController() {
         //mtm = new MusicTrackManager();
        mtm = AbstractMusicTrackManager.getInstance("");
    }

    public void createMusicTrack(Integer id, String title, String author, String album, Integer genre, int duration) throws NullPointerException{
        mtm.createMusicTrack(id, title, author, album, genre, duration);
    }

    public MusicTrack findTrackById(Integer id) throws NullPointerException{
        return mtm.findTrackById(id);
    }

    public void deleteTrackInLibraryById(Integer id) {
        mtm.deleteTrackInLibraryById(id);
    }

    public void saveMusicTrack(String path) throws FileNotFoundException, IOException {
        mtm.saveMusicTrack(path);
    }

    public void openMusicTrack(String path) throws FileNotFoundException, IOException, ClassNotFoundException {
        mtm.openMusicTrack(path);
    }

    public void editMusicTrack(Integer id, String title, String author, String album, Integer genre, int duration) {
        mtm.editMusicTrack(id, title, author, album, genre, duration);
    }

    public int getSizeLibrary() {
       return mtm.getSizeLibrary();
    }


    public MusicTrack getIdByTrackName(String author, String title) {
        return mtm.getIdByTrackName(author, title);
    }


}
